package com.mallcai.bigdata.ladon.service.report;

import com.alicp.jetcache.anno.Cached;
import com.mallcai.bigdata.ladon.dpl.entity.dashboard.SqlRunLogStatic;
import com.mallcai.bigdata.ladon.dpl.entity.report.SqlRunLog;

import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
 * Created by oneape<oneape15@163.com>
 * Created 2019-07-15 20:15.
 * Modify:
 */
public interface ISqlRunLogService {

    /**
     * 根据Id获取
     *
     * @param logId Long
     * @return SqlRunLog
     */
    public SqlRunLog getById(Long logId);

    /**
     * 根据条件查询日志
     *
     * @param params Map
     * @return List
     */
    public List<SqlRunLog> getByParams(Map<String, Object> params);

    /**
     * 插入一条sql运行日志
     *
     * @param sqlRunLog
     */
    void insert(SqlRunLog sqlRunLog);

    /**
     * 获取一天前的全部sql运行数据
     */
    public List<SqlRunLogStatic> getRunLogStatic();

    /**
     * 获取昨天的全部sql运行数据
     */
    public List<SqlRunLogStatic> getYesterdayRunLogStatic();

    /**
     * 删除一周前的全部sql运行数据
     */
    public int deleteLogOneWeekAgo();

    /**
     * 获取今天的访问量
     *
     * @return int
     */
    @Cached(expire = 1, timeUnit = TimeUnit.MINUTES)
    public int getTodayVisitSize();
}
